<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

	<ui:composition template="/faces/manager/xhtml/templates/template.xhtml">
		<ui:define name="manager-content">
			<table id="manager-content-panel" cellpadding="0" cellspacing="1">
				<tr>
					<td id="manager-content-header">
						<h:form>
							<p:breadCrumb style="width: 810px;">
								<p:menuitem value="#{msg['manager.menu.navigator.home']}"/>
								<p:menuitem ajax="false" value="#{msg['manager.menu.navigator.admin']}" action="/faces/manager/xhtml/main.xhtml"  />
								<p:menuitem value="#{msg['manager.menu.navigator.ramo']}" />
							</p:breadCrumb>		
						</h:form>
					</td>
				</tr>
				<tr>
					<td id="manager-content-body">
						<h:form id="formRamo">	
							<p:growl id="showMessages" showDetail="true" />
							<p:fieldset legend="#{msg['manager.menu.left.admin.ramo.title']}" styleClass="manager-fieldset-content">
								<table id="panel-buttons" cellpadding="0" cellspacing="0">
									<tr>
										<td>
											<p:commandButton value="#{msg['manager.ramo.button.create']}" 
												action="#{ramoController.create}" ajax="false" icon="add-button"/>
											<p:spacer width="10px"/>
											<p:commandButton value="#{msg['manager.ramo.button.update']}" id="button-alterar"
												action="#{ramoController.edit}" ajax="false" icon="edit-button" disabled="#{!ramoController.selectedRamo}" />
										</td>
									</tr>
								</table>
								<p:spacer height="10px"/>
							 	<p:dataTable 
									var="ramo" 
									value="#{ramoController.lazyModelRamo}" 									 
									rows="#{ramoController.pageSize}" 
									paginator="true"
									
									selection="#{ramoController.ramo}"
									emptyMessage="#{msg['messages.list.not.found']}">
									
									<p:ajax event="rowSelect" update=":formRamo:button-alterar" listener="#{ramoController.onSelectedRow}"/>
									<p:ajax event="page" update=":formRamo:button-alterar" listener="#{ramoController.onPaged}"/>  
									<p:column selectionMode="single"  style="width:18px" />
									  
									<p:column headerText="#{msg['manager.ramo.list.grid.column.nome']}" >
										<h:outputText value="#{ramo.nome}" />
									</p:column>
									
									<p:column headerText="#{msg['manager.ramo.list.grid.column.descricao']}">
										<h:outputText value="#{ramo.descricao}" />
									</p:column>	
									
									<p:column headerText="#{msg['manager.ramo.list.grid.column.status']}">
										<h:outputText value="#{msg['manager.ramo.list.label.ativo']}" rendered="#{ramo.ativo}"  />
										<h:outputText value="#{msg['manager.ramo.list.label.inativo']}" rendered="#{!ramo.ativo}"  />
									</p:column>	
													
								</p:dataTable>
								<p:spacer height="10px"/>								
							</p:fieldset>
						</h:form>
					</td>
				</tr>
			</table>
		</ui:define>
	
	</ui:composition>
</html>